package leetcode;

/**
 * @创建人 MBY381
 * @创建时间 2022/4/4 18:10
 * @描述 暂无
 */
public class Solution53 {
    /**
     * 超时垃圾
     *
     * @param nums
     * @return
     */
    public static int maxSubArray1(int[] nums) {
        int sum = 0, len = nums.length, max = nums[0];
        if (len == 1) {
            return nums[0];
        }
        for (int i = 0; i < len; i++) {
            int tag = i;
            while (tag < len) {
                max = Math.max(max, sum + nums[tag]);
                System.out.println("sum  lsum max    " + sum + "   " + (sum + nums[tag]) + "      " + max);
                sum = sum + nums[tag];
                tag++;
            }
            sum = 0;
        }
        return max;
    }

    public static int maxSubArray(int[] nums) {

        return 1;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{-2, 1, -3, 4, -1, 2, 1, -5, 4};
        System.out.println(maxSubArray(nums));
    }
}
